import tabs from "../tabs.js"

let page = {
    after_handle_a_field: function (field, col) {
        if (field.name == "config") {
            col.buttons = [{
                "type": "button",
                "icon": "fa fa-share-alt",
                "level": "success",                
                "size": "xs",           
                "label": "BPMN-DESIGN",
                "onClick": (a, b) => {
                    let id = b.data.id;
                    let name = b.data.name;
                    let config = b.data.config;
                    let diagram = b.data.diagram;
                    let form_id = b.data.form_id;
                    let this_property = {
                        id: id,
                        name: name,
                        config: config,
                        diagram: diagram,
                        form_id: form_id
                    }
                    let tab_id = "process_" + id;
                    let tab_label = '流程设计(' + id + ')';
                    tabs.open_by_page_type("tabs_container", tab_id, tab_label, "fa-edit", "process_builder_page_type", this_property)
                }
            }]
        }
        else if (field.name == "diagram" || field.name == "publish") {
            col.buttons[0].buttons[0].icon="fa fa-code";
        }
    }
};

export default page;